<template>
  <div class="h-dialog">
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      @before-close="close"
    >
      <el-form :model="data" label-position="left" label-width="130px">
        <el-form-item label="设备编号">
          <el-input v-model="data.id" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="设备名称">
          <el-input v-model="data.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="设备分类">
          <el-select v-model="data.type" placeholder="请选择设备分类">
            <el-option label="摄像头" value="1"></el-option>
            <el-option label="建筑物" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="设备地点">
          <el-input v-model="data.address"></el-input>
        </el-form-item>
        <el-form-item label="设备来源">
          <el-select v-model="data.from" placeholder="请选择设备来源">
            <el-option label="手工添加" value="1"></el-option>
            <el-option label="同步" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="是否在慧眼屏展示">
          <el-select v-model="data.show">
            <el-option label="是" value="1"></el-option>
            <el-option label="否" value="0"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="视频流媒体地址">
          <el-input v-model="data.streamUrl"></el-input>
        </el-form-item>
        <el-form-item label="场名称">
          <el-input v-model="data.cname"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="close">取 消</el-button>
        <el-button type="primary" @click="add">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: "hDialog",
  data() {
    return {};
  },
  props: {
    dialogVisible: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ""
    },
    data: {
      type: Object,
      default: {}
    }
  },
  methods: {
    close() {
      this.$emit("close");
    },
    add() {
      this.$emit("add", this.data);
    }
  }
};
</script>

<style lang="less">
.h-dialog {
  .el-select {
    width: 100%;
  }
}
</style>